package com.thd.example.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@TableName("thd_frameset_example")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="thd_frameset_example")
public class ThdFramesetExampleVO extends ThdFramesetExampleEntity {

    @JsonIgnore
    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

    @ApiModelProperty(value = "查询条件-生日上限")
    @TableField(exist = false)
    private String birthdayFrom;

    @ApiModelProperty(value = "查询条件-生日下限")
    @TableField(exist = false)
    private String birthdayTo;

    @ApiModelProperty(value = "查询条件-年龄上限")
    @TableField(exist = false)
    private Integer ageFrom;

    @ApiModelProperty(value = "查询条件-年龄下限")
    @TableField(exist = false)
    private Integer ageTo;

    public String getBirthdayFrom() {
        if(null != birthdayFrom && birthdayFrom.length() > 0){
            return birthdayFrom +  " 00:00:00";
        }
        return birthdayFrom;
    }

    public String getBirthdayTo() {
        if(null != birthdayTo && birthdayTo.length() > 0){
            return birthdayTo +  " 23:59:59";
        }
        return birthdayTo;
    }

    public void setBirthdayFrom(String birthdayFrom) {
        this.birthdayFrom = birthdayFrom;
    }

    public void setBirthdayTo(String birthdayTo) {
        this.birthdayTo = birthdayTo;
    }
}
